<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no,email=no"/>
    <meta name="apple-mobile-web-app-title" content="足彩"/>
    <title></title>
    <!--font-awsome-css-->
    <link rel="stylesheet" href="../public/styles/font-awesome.min.css">
    <!--bootstrap-->
    <link rel="stylesheet" href="../public/styles/bootstrap.min.css">
    <!--custom css-->
    <link rel="stylesheet" href="../public/styles/jquery-ui.css"/>
    <!-- 日期选择 -->
    <link rel="stylesheet" href="../public/styles/bootstrap-datepicker.min.css"/>

    <link rel="stylesheet" type="text/css" href="../public/styles/index.css"/>
    <link rel="stylesheet" href="../public/styles/common.css">

</head>
<body>
<div class="masthead pdng-stn1">
    <!-- 内容开始 -->
    <div class="phone-box wrap push">
        <div id="home" class="menu-notify setting-head" style="position: fixed;top: 0;width: 100%;height: 48px">
            <div class="profile-left">
                <a href="javascript:history.go(-1);" class="menu-link"><i class="fa fa-chevron-left"></i></a>
            </div>
            <div class="Profile-mid logo">
                <h1>
                    <span class="link">Password</span>
                </h1>
            </div>
            <div class="Profile-right w80">
                <a href="javascript:;" class="bets-btn inline-btn" id="pwdSave">Save</a>
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="usercenter" style="margin-top: 48px">
            <div class="setting-edit password-edit">
                <form action="">
                    <div class="form-group">
                        <div class="line-wrap pd15">
                            <label for=""
                                   style="width: 100px;padding-right: 10px;align-content: flex-start;text-align: left">Old
                                Password</label><input type="password" class="form-control" name="oldPassWord" style="width: 90%;">
                        </div>
                        <div class="line-wrap pd15">
                            <label for=""
                                   style="width: 110px;padding-right: 10px;align-content: flex-start;text-align: left">New
                                Password</label><input type="password" class="form-control" name="newPassWord" style="width: 90%;">
                        </div>
                        <div class="line-wrap">
                            <label for="" style="width: 130px;padding-right: 10px;align-content: flex-start;text-align: left">Confirm Password</label><input
                                type="password" class="form-control" name="confirmPwd" style="width: 90%;">
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript" src="../public/scripts/vendor/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="../public/scripts/vendor/bootstrap.min.js"></script>
<script type="text/javascript" src="../public/scripts/vendor/jquery.cookie.js"></script>
<!-- 时间插件 -->
<script type="text/javascript" src="../public/scripts/vendor/bootstrap-datepicker.min.js"></script>
<script type="text/javascript" src="../public/scripts/common.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $('#pwdSave').on('click', function () {

            var oldPwd = $('input[name="oldPassWord"]').val();
            var newPwd = $('input[name="newPassWord"]').val();
            var confirm = $('input[name="confirmPwd"]').val();
            if (oldPwd == "") {
                $.blt('Please enter the oldPassWord');
                return;
            } else if (newPwd == "") {
                $.blt('Please enter the newPassWord');
                return;
            }
            if (newPwd != confirm) {
                $.blt('New and confirmed passwords are not the same');
                return;
            }
            $.ajax({
                type: 'get',
                url: apiDomain + '/user/updatePwd?' + new Date().getTime(),
                dataType: "json",
                cache: false,
                data: {
                    userId: $.cookie('userId'),
                    oldPassWord: oldPwd,
                    newPassWord: newPwd
                },
                success: function (data) {
                    if (data.code == "0") {
                        $.blt('SUCCESS', function () {
                            window.location.href = 'user.html';
                        })
                    } else {
                        $.blt(data.msg);
                    }
                }
            })
        })

    });

</script>
</body>
</html>